﻿using SqlSugar;
using SqlSugar.Extensions;
using System;
using System.ComponentModel;

namespace NCP.Model
{
    [SugarTable("v_DrugCompare")]
    public class VVarietyDrugCompare
    {
        public string GpCode { get; set; }

        [Description("集采名称")]
        public string GpName { get; set; }

        public string DrugCode { get; set; }
        [Description("中选药品名称")]
        public string DrugName { get; set; }
        [Description("中选药品规格")]
        public string Specs { get; set; }
        [Description("中选药品单价")]
        public string UnitPrice { get; set; }

        [Description("生产厂家")]
        public string ProducerName { get; set; }
        [Description("中选药品最小计价单位的含量换算系数")]
        public string Ratio { get; set; }

        [Description("中选药品医保局规定使用占比")]
        public string TaskRatio { get; set; }

        [SugarColumn(IsIgnore = true)]
        public string TaskRatioStr
        {
            get
            {
                return Math.Round(string.IsNullOrEmpty(TaskRatio) ? 0 : TaskRatio.ObjToDecimal(), 2).ToString() + "%";
            }
        }

        [Description("开始时间")]
        public DateTime? BeginDate { get; set; }
        [Description("结束时间")]
        public DateTime? EndDate { get; set; }
        [Description("中选药品年度任务量")]
        public int TaskQty { get; set; }

        #region 

        [SugarColumn(IsIgnore = true)]
        [Description("中选药品入库数量")]
        public decimal InNum { get; set; }
        [SugarColumn(IsIgnore = true)]
        [Description("中选药品使用数量")]
        public decimal UseNum { get; set; }
        [SugarColumn(IsIgnore = true)]
        [Description("中选药品任务完成进度")]
        public string TaskRate
        {
            get
            {
                return Math.Round(TaskQty == 0 ? 0 : UseNum * 100 / TaskQty, 2).ToString()+"%";
            }
        }
        [SugarColumn(IsIgnore = true)]
        [Description("中选药品使用占比")]
        public string UseRatio { get; set; }
        [Description("结束时间")]
        [SugarColumn(IsIgnore = true)]
        public string EndDateStr
        {
            get
            {
                if (EndDate.HasValue)
                    return EndDate.Value.ToString("yyyy-MM-dd");
                return "";
            }
        }
        #endregion


    }
}
